Skip to content

Check PHP 7.4 compatibility in PHPCS with PHPCompatibilityWP (Phase A2) - #151

Merged
dknauss merged 1 commit into
mainfrom
claude/keen-tesla-49orwb-edit-fields
Oct 14, 2026
Merged

dknauss merged 1 commit into
mainfrom
claude/keen-tesla-49orwb-edit-fields

Conversation

@dknauss

@dknauss dknauss commented Oct 14, 2026

Copy link
Copy Markdown
Owner

Summary

Phase A, ticket 2 of docs/planning/refactor-and-standards-memo.md.

The plugin declares Requires PHP: 7.4. Until now, PHP 8-only syntax would only be caught by the runtime matrix's single PHP 7.4 cell. That's late and coarse. This PR adds PHPCompatibilityWP to phpcs.xml.dist with testVersion 7.4-, so composer lint:php catches it up front, and CI already runs that command.

Why the alpha versions. I tried the stable phpcompatibility-wp 2.1.8 / php-compatibility 9.3.5 first. It ran a probe file containing match and ?-> and reported nothing, because 9.3.5 knows nothing past PHP 7.4. The 10.0 alpha line (php-compatibility 10.0.0-alpha2, phpcompatibility-wp 3.0.0-alpha2, -paragonie 2.0.0-alpha2) flags both. It's the line the WordPress tooling ecosystem uses for PHP 8 checks.

The @alpha flags are on these dev-only packages only. The release ZIP installs --no-dev and is unaffected.

str_contains() and the other functions WordPress polyfills are allowed, as PHPCompatibilityWP intends.

Validation

  • composer lint:php: passes on current code. All 14 plugin PHP files are compatible with PHP 7.4.
  • With a temporary probe file in includes/, the repo ruleset reports:
    • PHPCompatibility.Operators.NewOperators.t_nullsafe_object_operatorFound;
    • PHPCompatibility.Keywords.NewKeywords.t_matchFound.
  • The probe was removed afterwards; it isn't committed.

Checklist

  • No behavior change; dev tooling only
  • CI enforces it via the existing composer lint:php step

🤖 Generated with Claude Code

https://claude.ai/code/session_01KbVuMPN7YTcV27vwsG3LZ2


Generated by Claude Code

The plugin declares Requires PHP: 7.4, but only the runtime matrix's one
PHP 7.4 cell would catch PHP 8-only syntax. PHPCompatibilityWP now runs
in composer lint:php with testVersion 7.4-. It uses the 10.0 alpha line:
the stable 9.3.5 knows nothing past PHP 7.4 and passed a probe using
match and ?-> without a word. Current code passes clean.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KbVuMPN7YTcV27vwsG3LZ2
@codecov

codecov Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.28%. Comparing base (4d638a2) to head (9d73afe).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##               main     #151   +/-   ##
=========================================
  Coverage     88.28%   88.28%           
  Complexity       22       22           
=========================================
  Files            61       61           
  Lines          7290     7290           
  Branches        690      690           
=========================================
  Hits           6436     6436           
  Misses          291      291           
  Partials        563      563           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dknauss
dknauss marked this pull request as ready for review October 14, 2026 23:18
@dknauss
dknauss merged commit db72df7 into main Oct 14, 2026
19 checks passed
@dknauss
dknauss deleted the claude/keen-tesla-49orwb-edit-fields branch October 14, 2026 23:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants